MITK_CREATE_MODULE_TESTS()

# mitkAddCustomModuleTest(mitkRoiMeasurementsTests mitkRoiMeasurementsTest ${MITK_DATA_DIR}/ImageStatisticsTestData/)

file(GLOB allHotSpotTests RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/Data/Hotspot" "${CMAKE_CURRENT_SOURCE_DIR}/Data/Hotspot/*.xml")
foreach(testcase ${allHotSpotTests})
  string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" testcaseName ${testcase})
  mitkAddCustomModuleTest(mitkImageStatisticsHotspotTest_${testcaseName} mitkImageStatisticsHotspotTest ${CMAKE_CURRENT_SOURCE_DIR}/Data/Hotspot/${testcase})
endforeach()

#
# The following lines may be activated to generate new test cases for mitkImageStatisticsHotspotTest.
# Test cases are generated by mitkMultiGaussianTest. All .xml files in Data/TestGeneration/Input will
# be processed and transformed into new .xml files containing statistics in Data/TestGeneration/Output.
#
if (false)
  set(testInputDir ${CMAKE_CURRENT_SOURCE_DIR}/Data/TestGeneration/Input)
  set(testOutputDir ${CMAKE_CURRENT_SOURCE_DIR}/Data/TestGeneration/Output)
  file(GLOB testcasesToGenerate RELATIVE "${testInputDir}" "${testInputDir}/*.xml")

  if (NOT EXISTS ${testOutputDir})
    file(MAKE_DIRECTORY ${testOutputDir})
  endif()

  foreach(testinput ${testcasesToGenerate})
    string(REGEX REPLACE "[^a-zA-Z0-9_]\\+" "_" testcaseName ${testinput})
    string(REGEX REPLACE "\\.xml" "" testoutput ${testinput})
    message("Generate hotspot test case '${testinput}'. Output in '${testoutput}.xml' and '${testoutput}.nrrd'")
    mitkAddCustomModuleTest(mitkMultiGaussianTest_${testcaseName}
                            mitkMultiGaussianTest
                            ${testOutputDir}/${testoutput}
                            ${testInputDir}/${testinput})
  endforeach()
endif()
